package com.shanliao.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

import com.shanliao.version.CustomRequestMappingHandlerMapping;

/**
 * 
 * @author Administrator
 *
 */
@Configuration
public class CustomWebMvcConfigurerAdapter extends WebMvcConfigurationSupport {
   
    
    
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
    	  // addResourceHandler指的是访问路径，addResourceLocations指的是文件放置的目录  
        registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/");
    	super.addResourceHandlers(registry);
    }
    
    @Override
    public RequestMappingHandlerMapping requestMappingHandlerMapping() {
        RequestMappingHandlerMapping handlerMapping = new CustomRequestMappingHandlerMapping();
        handlerMapping.setOrder(0);
        handlerMapping.setInterceptors(getInterceptors());
        return handlerMapping;
    }
}